class Solution {
    public int removeDuplicates(int[] nums) {
        int len = 0;

        for(int left = 0,right = 0;right < nums.length;){
            if(nums[right] == nums[left]){
                right ++;
            }else{
                nums[++ left] = nums[right];
            }
            len = left + 1;
        }

        return len;
    }
}